-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(netxlite): add flexible HTTP transport factory #1270
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now that we've clearly labeled and package technical debt, we can copy existing technical-debt-ridden code and modify it to obtain a flexible factory for creating HTTP transports. In particular, this factory uses sensible defaults for measuring and there are options that you can pass it to customize details such as the backend proxy as well as other underlying behavior that we previously unconditionally configured. This factory will be the starting point for having custom network functions for the engine in line with ooni/probe#2531.
bassosimone
commented
Sep 14, 2023
bassosimone
commented
Sep 14, 2023
bassosimone
commented
Sep 14, 2023
bassosimone
commented
Sep 14, 2023
Murphy-OrangeMud
pushed a commit
to Murphy-OrangeMud/probe-cli
that referenced
this pull request
Feb 13, 2024
Now that we've clearly labeled and packaged technical debt, we can copy existing technical-debt-ridden code and modify it to obtain a flexible factory for creating HTTP transports, `NewHTTPTransportWithOptions`. In particular, this factory uses sensible defaults for measuring and there are options that you can pass it to customize details such as the backend proxy that we previously unconditionally configured. More in detail, this is a side-by-side comparison between new code's defaults and old code: | Setting Name | httpquirks.go (old code) | httpfactory.go (new code) | | ------------------- | ------------------------ | -------------------------- | | .Proxy | nil | nil | | .MaxConnsPerHost | 1 | ooni/oohttp's default | | .DisableCompression | true | true | | .ForceAttemptHTTP2 | true | true | So, basically, the biggest change is that we've removed the limitation of the max number of connections per host being set to 1. In any case, the new code allows to configure each of these fields. This factory will be the starting point for having custom network functions for the engine in line with ooni/probe#2531. While there, acknowledge that `NewHTTPClient` contains technical debt because it does unconditionally disable cookies, to document that and move it inside of the proper file (`httpquirks.go`).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that we've clearly labeled and packaged technical debt, we can copy existing technical-debt-ridden code and modify it to obtain a flexible factory for creating HTTP transports,
NewHTTPTransportWithOptions
.In particular, this factory uses sensible defaults for measuring and there are options that you can pass it to customize details such as the backend proxy that we previously unconditionally configured.
More in detail, this is a side-by-side comparison between new code's defaults and old code:
So, basically, the biggest change is that we've removed the limitation of the max number of connections per host being set to 1. In any case, the new code allows to configure each of these fields.
This factory will be the starting point for having custom network functions for the engine in line with ooni/probe#2531.
While there, acknowledge that
NewHTTPClient
contains technical debt because it does unconditionally disable cookies, to document that and move it inside of the proper file (httpquirks.go
).